<template>
	<view class="floor-item">
			<view class="floor-title">
				<image :src="floorItem.floor_title.image_src" class="floor-title" mode="widthFix"></image>
			</view>
			<view class="floor-content">
				<view class="left">
					<image :src="floorItem.product_list[0].image_src" mode="widthFix" 
					:style="{width: floorItem.product_list[0].image_width + 'rpx'}"
					:data-url="floorItem.product_list[0].url"
					 @click="onLeftItemClicked"
					></image>
				</view>
				<view class="right">
					<view class="right-item" v-for="(rightItem,index) in floorItem.product_list" v-if="index !== 0" :key="rightItem.name"
						@click="onRightItemClicked" :data-url="rightItem.url"
					>
						<image :src="rightItem.image_src" mode="widthFix" :style="{width: rightItem.image_width + 'rpx'}"></image>
					</view>
				</view>
			</view>
	</view>
</template>

<script>
	export default {
		name:"floorItem",
		props: {
			floorItem: {
				type: Object,
				default: {}
			}
		},
		data() {
			return {
				
			};
		},
		onLoad() {
			console.log('wdnmd');
		},
		methods: {
			onLeftItemClicked(event) {
				const url = event.currentTarget.dataset.url
				uni.navigateTo({
					url
				})
			},
			
			onRightItemClicked(event) {
				const url = event.currentTarget.dataset.url
				console.log(url);
				uni.navigateTo({
					url
				})
			}
		}
	}
</script>

<style>
	.floor-item {
		margin-top: 36rpx;
	}
	
	.floor-content {
		padding: 12rpx;
		display: flex;
	}
	
	.right {
		display: flex;
		justify-content: space-around;
		flex-wrap: wrap;
	}
</style>
